package com.gin.kotlin.no_gay_alliance.adapter.user

import android.content.Context
import com.gin.kotlin.no_gay_alliance.R
import com.gin.kotlin.no_gay_alliance.base.AbstractBindingRecyclerViewAdapter
import com.gin.kotlin.no_gay_alliance.base.MyHandler
import com.gin.kotlin.no_gay_alliance.database.entity.IpLocationHistory
import com.gin.kotlin.no_gay_alliance.databinding.ItemIpLocationHistoryBinding
import com.gin.kotlin.no_gay_alliance.utils.TimeUtils.Companion.zdtIntoTextView

class IpLocationAdapter(context: Context, handler: MyHandler) : AbstractBindingRecyclerViewAdapter<ItemIpLocationHistoryBinding, IpLocationHistory>(context, handler) {
    override fun onBindViewHolder(holder: ViewHolder<ItemIpLocationHistoryBinding>, position: Int, b: ItemIpLocationHistoryBinding, dataModel: IpLocationHistory) {
        b.tvIpLocation.text = dataModel.location
        val defaultTextColor = getAttrColor(R.attr.textColor)
        // 创建时间文字，颜色
        zdtIntoTextView(context, dataModel.timestamp, b.tvTimestamp, defaultTextColor)
    }
}